/*
 This is the class for Restore Information Display

 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.cloudminga.database;
/**
 *
 * @author USER
 */
import java.io.File;
import java.sql.*;
import javax.swing.JFileChooser;
public class Restore_DatabaseDisplay {
        Statement statement;
        Connection connection=null;
        ResultSet resultSet=null;
        ResultSet resultSet1;
        CallableStatement callableStatement;
        ResultSetMetaData resultsetMetaData;
        String query;
        String email_Id;
        TableModel table_Model;
        int colCount=0;
        int rowCount;

    public Restore_DatabaseDisplay()
    {
        try
        {
            // Establising database connection
            Class.forName("net.sourceforge.jtds.jdbc.Driver");
            connection = DriverManager.getConnection("jdbc:jtds:sqlserver://mssql502.ixwebhosting.com/C230527_masterdatabase","C230527_sumit","Globus1234");
          
         }  // End of try

         catch(Exception exception)
          {
             exception.printStackTrace();
         }// End of catch
      }//end of constructor

    public Object[][] get_RestoreInfo(String email)
    {
        int temp;
        int row=0;
        this.email_Id=email;
        Object[][] data=null;
        try
          {                                                
            callableStatement=connection.prepareCall("{call sp_pomblast_GetRestore(?)}",ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_READ_ONLY);
            callableStatement.setString(1, email_Id);
            resultSet=callableStatement.executeQuery();
            resultSet.last();
            int totalRows=resultSet.getRow();
            resultSet.beforeFirst();
            data= new Object[totalRows][4];
            int counter=0;         
            while(resultSet.next())
            {
              data[counter][0]=resultSet.getString(1);
              data[counter][1]=resultSet.getString(2);
              data[counter][2]=resultSet.getString(3);
              data[counter++][3]=resultSet.getString(4);
            }
          }
        catch(Exception exception)
        {
            exception.printStackTrace();
        }
     return data;
     
    }
}
